/*****************************************************************************/
/** \file mc_mras.h
**
** 
**
** History:
** 
*****************************************************************************/
#ifndef  __MC_MRAS_H__
#define  __MC_MRAS_H__

/*****************************************************************************/
/* Include files */
/*****************************************************************************/

/*****************************************************************************/
/* Global pre-processor symbols/macros ('#define') */
/*****************************************************************************/
#define  s8   signed char
#define  s16  signed short int
#define	 s32  signed int 
#define	 s64  signed long int
#define	 u8   unsigned char 
#define	 u16  unsigned short int 
#define	 u32  unsigned int 


#define   MRAS_A    	(31349)
#define   MRAS_B     	(1364)
#define   MRAS_C     	(2878)
#define   MRAS_D     	(1364)
#define   MRAS_E     	(1492)
#define   MRAS_F     	(708)
#define   MRAS_G     	(916)

#define   MRAS_KP     	(65535)
#define   MRAS_KI     	(1000)

#define   MRAS_Ud_Ref   (8000)
#define   MRAS_Uq_Ref   (2000)


/*****************************************************************************/
/* Global type definitions ('typedef') */
/*****************************************************************************/
typedef struct
{
	s32 A;
	s32 B;
	s32 C;
	s32 D;
	s32 E;
	s32 F;	
	s32 G;	
	s32 Ud;
	s32 Uq;
	s32 Id;
	s32 Iq;
	s32 Idt;
	s32 Iqt;
	s32 Idt_Pre;
	s32 Iqt_Pre;	
	s32 idiqt;
	s32 iqidt;
	s32 UdRef;
	s32 UqRef;	
	s32 we;
	s32 Cwe;
	s32 Er_we;	
	s32 PI_p;
	s32 PI_i;
	s32 KiSum;
	s32 PI_out;
	s32 DeltaTheta;
	s32 Angle;	
	
}Mras_Components;

/*****************************************************************************/
/* Global variable declarations ('extern', definition in C source) */
/*****************************************************************************/
extern Mras_Components	s_Mras;

/*****************************************************************************/
/* Global function prototypes ('extern', definition in C source) */
/*****************************************************************************/
void MC_MRAS_EstAngle(Mras_Components *p);
void MC_MRAS_Init(Mras_Components *p);
void MC_MRAS_Theta_Calc(Mras_Components *p);


#endif    /* __MC_MRAS_H__ */   


